package main

import (
	"encoding/json"
	"fmt"
)

func main() {
	res, err := json.Marshal([]string{"a"})
	if nil != err {
		fmt.Println(err)
	} else {
		fmt.Println(string(res)) // ["a"]
	}

	// 结构体内必须大写才能转换为json
	res2, _ := json.Marshal(struct {
		Company string
		Subject []string
		isok    bool
	}{"MD", []string{"A", "B"}, true})
	fmt.Println(string(res2)) // {"Company":"MD","Subject":["A","B"]}

}
